package com.welab.task3.exceptions;

import com.welab.task3.enumeration.StatusEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author dammein.yuan
 * @version v1.0
 * @Title: com.welab.task3.exceptions
 * @Description: 统一异常管理
 * @Copyright: © 2020 ***
 * @Company: ***有限公司
 * @date 2020-3-9
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BaseException extends  RuntimeException {
    private Integer code;
    private String msg;

    public BaseException(StatusEnum statusEnum) {
        this.code = statusEnum.getCode();
        this.msg = statusEnum.getMsg();
    }

    public BaseException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }
}
